﻿using System.Collections.Generic;
using System.ComponentModel;

using PagedList;

namespace WebCommon.Api
{
    /// <summary>
    /// AppView分页
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class RetPagedList<T> : Ret<IPagedList<T>> where T : class
    {

        /// <summary>
        /// 分页数组,包块分页对象
        /// </summary>
        /// <param name="pagedList">显示数组</param> 
        public RetPagedList(IPagedList<T> pagedList)
        {
            
               PageCount = pagedList.PageCount;
            TotalItemCount = pagedList.TotalItemCount;
            this.Data = pagedList;
        }

        /// <summary>
        /// 分页数组,包块分页对象
        /// </summary>
        /// <param name="showList">显示数组</param>
        /// <param name="pagedList">分页数组</param> 
        public RetPagedList(IEnumerable<T> showList, IPagedList pagedList)
        {

            PageCount = pagedList.PageCount;
            TotalItemCount = pagedList.TotalItemCount;
            this.Data = new StaticPagedList<T>(showList, pagedList);
        }



        /// <summary>
        /// 分页数据
        /// </summary>
        [DisplayName("总页数")]
        public int PageCount { get; protected set; }

        /// <summary>
        /// 分页数据
        /// </summary>
        [DisplayName("总条数")]
        public int TotalItemCount { get; protected set; }


    }
}